/*
 * ArrayList.h
 *
 *  Created on: 25.09.2012
 *      Author: Lapchinskiy
 */
#include "Global_types.h"
//#include "BuildConfig.h"
//#include "Logging.h"
#include <string.h>
#ifndef ARRAYLIST_H_
#define ARRAYLIST_H_
const unsigned char listGrowStep = 2;
//enum ArrayListExeptionType {
//	INDEX_OUT_OF_RANGE, NO_ELEMENT_ON_REQUESTED_INDEX
//};

//class ArrayListExeption {
//public:
//	ArrayListExeptionType nameId;
//	ArrayListExeption(ArrayListExeptionType name_id) {
//		this->nameId = name_id;
//		this->nameId = name_id;
//	}
//};
class ArrayList {
public:
	uint8_t** arraybuf;
	ArrayList();
	ArrayList(uint16_t elemNum);
	~ArrayList();
	ErrorCode add(void* newItem);
	ErrorCode add(void* newItem, uint16_t index);
	ErrorCode remove(uint16_t index);
	ErrorCode remove();
	ErrorCode clear(void);
	void* get(uint16_t index);
	uint16_t getSize() const;
	uint16_t getLength() const;
private:
	uint16_t length;
	volatile uint16_t indexPointer;
	static const uint16_t defaultElementsNumber = 5;
};


#endif /* ARRAYLIST_H_ */

